package cn.tworice.upload.client;

import cn.tworice.upload.client.local.LocalFileClient;
import cn.tworice.upload.client.minio.MinioFileClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

@Configuration
public class FileClientConfig {

    @Resource
    private FileClientProperties fileClientProperties;

    @Bean
    public FileClient getFileClient() {
        switch (fileClientProperties.getClient()) {
            case "local":
                return new LocalFileClient();
            case "minio":
                return new MinioFileClient();
        }
        return new LocalFileClient();
    }
}
